<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>计数器</title>
	</head>
	<body>
		<input type="button" value="开始计数" onclick="start()" />
		<input type="text" />
		<input type="button" value="暂停计数" onclick="stop()" />
		<script>
			var timer;
			var c=1;
			function myCount(){
				document.getElementById('count').value=c;
				c=c+1;
			}
			function start(){
				timer=setInterval(myCount,1000);
			}
			function stop(){
				clearInterval(timer);
			}
		</script>
	</body>
</html>
